<form class="layui-form seller-form" action="">
    <div class="layui-form-item">
        <div class="layui-inline" style="padding-left: 5px;">
            <input type="text" name="limit" lay-verify="title" placeholder="Input limit" autocomplete="off"
                   class="layui-input" value="50" style="width: 100px;">
        </div>
        <div class="layui-inline" style="padding-left: 5px;">
            <input type="text" name="to_user" lay-verify="title" placeholder="Input to_user" autocomplete="off"
                   class="layui-input" value="" style="width: 400px;">
        </div>
        <div class="layui-inline">
            <select name="type" >
                <option value="">请选择类型</option>
                <option value="Transfer">Transfer</option>
                <option value="Approval">Approval</option>
            </select>
        </div>
        <div class="layui-inline">
            <div class="layui-input-block">
                <button class="layui-btn layui-btn-sm" lay-submit lay-filter="*"><i class="iconfont icon-chaxun"></i>Search</button>
            </div>
        </div>
    </div>
</form>
<div class="table-body">
    <table id="balanceTable" lay-filter="balanceTable"></table>
</div>
<script>
    layui.use(['form', 'laydate', 'table',], function () {
        var laydate = layui.laydate,
            form = layui.form,
            table = layui.table; //表格
        //时间插件
        laydate.render({
            elem: '#datetime',
            range: '_',
            format: 'yyyy-MM-dd'
        });
        table.render({
            elem: '#balanceTable',
            height: 'full-99',
            cellMinWidth: '80',
            totalRow: true,
            method: 'post',
            url: "{:url('oyTrans')}",
            id: 'balanceTable',
            cols: [[
                { type: 'numbers'},
                { field: 'time',  align: 'left', title: 'time',width:180},
                { field: 'amount', title: 'amount', align:"right",
                    style:'color:#FF5722;font-weight:bold', totalRow: true,width:150},
                { field: 'type',  align: 'left', title: 'Type',width:120,
                    templet: function (d) {
                        const type =d.type;
                        var   color = "#7DA0B1";
                        if(type == 'Transfer'){
                            color = 'green';
                        }else if(type == 'Approval'){
                            color = 'red';
                        }
                        return '<span style="color: ' + color + '">' + type + '</span>';
                    }
                },
                { field: 'from',  align: 'left', title: 'from',width:250},
                { field: 'to',  align: 'left', title: 'to',width:350},
                { field: 'txid',  align: 'left', title: 'txid'}

            ]],
            page: true,
            limit: 50,
            limits: [50,1000, 10000],
        });
        form.on('submit(*)', function (data) {
            layui.table.reload('balanceTable', {
                where: data.field
                , page: {
                    curr: 1 //重新从第 1 页开始
                }
            });
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });
    });
</script>